/*
 * Copyright (C) 2011 : Gilles Coomans 
 * 
 * This file is part of QuintEssence.
 * QuintEssence is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * QuintEssence is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with QuintEssence.  If not, see <http://www.gnu.org/licenses/>.
 */

package net.exprom.qe.testcases;
import haxe.unit.TestCase;
import net.exprom.qe.MetaModel;
import net.exprom.qe.QECore;

/**
assertEquals(a, b)
Succeeds if a and b are equal, Where a is value tested and b is the expected value.

assertTrue(a)
Succeeds if a is true

assertFalse(a)
Succeeds if a is false

 * @author Gilles Coomans
 */

class TestQE extends TestCase
{

	public function new() 
	{
		super();
		trace("TestQE.TestQE");
	}
	
	override public function setup():Void
	{
		super.setup();
	}
	
	override public function tearDown():Void 
	{
		super.tearDown();
	}
	
	public function testStack()
	{
		// SETUP
		
		var model1:MetaModel = new MetaModel("model1", "qem.test");
		QECore.addModel(model1);
		var model1Raw = { name:"model1", stack:["qem.test.model2", "qem.test.model3"] };
		model1.applyRawModel(model1Raw);
		
		var model2:MetaModel = new MetaModel("model2", "qem.test");
		QECore.addModel(model2);
		var model2Raw = { comment:"My comment" };
		model2.applyRawModel(model2Raw);
		
		var model3:MetaModel = new MetaModel("model3", "qem.test");
		QECore.addModel(model3);
		var model3Raw = { label:"My label" };
		model3.applyRawModel(model3Raw);
		
		var model4:MetaModel = new MetaModel("model4", "qem.test");
		QECore.addModel(model4);
		var model4Raw = { label:"My label2" };
		model4.applyRawModel(model4Raw);
		
		
		// TEST
		
		assertTrue(model1.applyBackground());
		assertEquals(model1.label, "My label");
		assertEquals(model1.comment, "My comment");

		model1.applyStack(model4, false);
		assertEquals(model1.label, "My label");
		
		model1.applyStack(model4);
		assertEquals(model1.label, "My label2");
		
		model1.setTransparent("label");
		model1.applyStack(model3, false);
		assertEquals(model1.label, "My label");
	}
	
}